package com.emar.adx.yiqifa.dao;

import org.springframework.data.domain.Page;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.data.mongodb.core.query.Update;

import java.util.List;

/**
 * Created by Administrator on 2015/11/17.
 */
public interface BaseMongoDAO<T> {

    /**
     * @param query
     */
    public List<T> find(Query query) ;

    /**
     * @param query
     * @return
     */
    public T findOne(Query query) ;

    /**
     * @param query
     * @param update
     * @return
     */
    public void update(Query query, Update update) ;

    /**
     * @param entity
     * @return
     */
    public T save(T entity) ;

    /**
     * @param id
     * @return
     */
    public T findById(String id) ;

    /**
     * @param id
     * @param collectionName
     * @return
     */
    public T findById(String id, String collectionName) ;

    /**
     * @param page
     * @param query
     * @return
     */
    public Page<T> findPage(Page<T> page,Query query);

    /**
     * @param query
     * @return
     */
    public long count(Query query);
}
